<%-- 
    Document   : addManufacturer
    Created on : Nov 3, 2011, 2:00:01 AM
    Author     : Admin
--%>

<%@page import="javax.rmi.PortableRemoteObject"%>
<%@page import="manufacturerBean.ManufacturerHome"%>
<%@page import="manufacturerBean.Manufacturer"%>
<%@page import="categoryBean.Category"%>
<%@page import="categoryBean.CategoryHome"%>
<%@page import="goodsBean.Goods"%>
<%@page import="goodsBean.GoodsHome"%>
<%@page import="javax.naming.InitialContext"%>
<%@page import="DBConnection.ATeamObject"%>
<%@ page errorPage = "Error.jsp" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Добавление производителя</title>
        <%  InitialContext initialContext;

            Manufacturer manufacturer;
            ManufacturerHome manufacturerHome;
            Object homeObject;

            ATeamObject ato = new ATeamObject();

            initialContext = new InitialContext();

            homeObject = initialContext.lookup("ManufacturerBean");
            manufacturerHome = (ManufacturerHome) PortableRemoteObject.narrow(
                    homeObject,ManufacturerHome.class);
    %>
    </head>
    <body background="1.jpg" bgproperties="fixed">
        <h4>
            <a href="index.jsp">Главная</a> / 
            <a href="addManufacturer.jsp">Добавление производителя</a>
        </h4>
        <h1>Добавление производителя</h1>
        <%  if (request.getParameter("name") != null) {                
                ato.setName(request.getParameter("name"));
                ato.setObjectDescription(request.getParameter("description"));
                manufacturer = manufacturerHome.create(ato);                
                response.sendRedirect("index.jsp");
            }
            
        %>
        <form action="addManufacturer.jsp" method="POST">
            <p>Введите название производителя</p>
            <input type="text" name="name" value="" size="50" />
            <p>Введите описание производителя</p>
            <input type="text" name="description" value="" size="50" />
            <p><input type="submit" value="Добавить" name="add" /></p>
        </form>
    </body>
</html>
